using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace NativeWiFiLibrary
{
    internal static class WlanConv
    {
        public static int GetChannelFromFrequency(int frequency)
        {
            switch (frequency / 1000)
            {
                case 2412: return 1;
                case 2417: return 2;
                case 2422: return 3;
                case 2427: return 4;
                case 2432: return 5;
                case 2437: return 6;
                case 2442: return 7;
                case 2447: return 8;
                case 2452: return 9;
                case 2457: return 10;
                case 2462: return 11;
                case 2467: return 12;
                case 2472: return 13;
                case 2484: return 14;
                default: return 15;
            }
        }

        public static string GetAuthentication(AuthenticationAlgorithm authenticationAlgorithm)
        {
            switch (authenticationAlgorithm)
            {
                case AuthenticationAlgorithm._80211Open:
                    return "Open";
                case AuthenticationAlgorithm._80211SharedKey:
                    return "Shared";
                case AuthenticationAlgorithm.Rsna:
                    return "WPA2-Enterprise";
                case AuthenticationAlgorithm.RsnaPsk:
                    return "WPA2-Personal";
                case AuthenticationAlgorithm.Wpa:
                    return "WPA-Enterprise";
                case AuthenticationAlgorithm.WpaNone:
                    return "WPA-None";
                case AuthenticationAlgorithm.WpaPsk:
                    return "WPA-Personal";
                default:
                    return "Own";
            }
        }

        public static string GetEncryption(CipherAlgorithm encryptionAlgorithm)
        {
            switch (encryptionAlgorithm)
            {
                case CipherAlgorithm.Ccmp:
                    return "AES";
                case CipherAlgorithm.None:
                    return "None";
                case CipherAlgorithm.Tkip:
                    return "TKIP";
                case CipherAlgorithm.Wep:
                    return "WEP";
                case CipherAlgorithm.Wep104:
                    return "WEP104";
                case CipherAlgorithm.Wep40:
                    return "WEP40";
                case CipherAlgorithm.WpaUseGroup:
                    return "Group";
                default:
                    return "Own";
            }
        }
    }
}
